package com.dgut.spring.dao;

import javax.swing.tree.RowMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.dgut.spring.exception.IsNullException;

@Repository
public class UserDaoImpl implements UserDao {

	@Autowired
	private JdbcTemplate template;
	
	@Override
	public String changePWD(int id) {
		String sqlString = "select pwd from user where id = ?";
		String resultString = template.queryForObject(sqlString, String.class,id);
		if(resultString == null) {
			throw new IsNullException("pwd is null");
		}
		return resultString;
	}
}
